package gui;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;

public class Register extends JFrame{
	private static final long serialVersionUID = 1L;
	JTextField user = new JTextField();
	JButton submit = new JButton("Register");
	
	public Register(){
		try{
			run();
			Thread.currentThread().interrupt();
		}catch(Exception e){
			System.out.println(e.getMessage());
		}
	}
	
	public void run() throws Exception{
		user.setText("Enter desired username here!");
		this.getContentPane().add(user);
		this.getContentPane().add(submit);
		this.pack();
		this.setLayout(new GridLayout(2,1));
		this.setVisible(true);
		this.setSize(200,100);
		this.setResizable(false);
		this.validate();
		submit.addActionListener(new ActionListener() {
 
            public void actionPerformed(ActionEvent e){
                System.out.println("You clicked the button");
				Thread.interrupted();
            }
        });
		this.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(1);
            }
        });
	}
	

}
